home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Programming / amigatalk / general / Class.st < prev    next >
Encoding:
Text File  |  2001-02-27  |  2.0 KB  |  85 lines

  1. " ----------------------------------------------------------"
  2. " Added getByteArray: methodString  method on 09/26/1998.   "
  3. " Added basicNew & basicNew:               on 08/20/2000.   "
  4. "-----------------------------------------------------------"
  5.  
  6. Class Class
  7. [
  8.   edit
  9.     <primitive 150 self>
  10. |
  11.   list
  12.     <primitive 157 self>
  13. |
  14.   basicNew ! superclass newinstance !
  15.  
  16.     superclass <- <primitive 151 self>. "151 <= findSuperClass"
  17.  
  18.     <primitive 3 superclass>  "respondsToNew: superclass"
  19.       ifTrue: [newinstance <- superclass new].
  20.  
  21.     newinstance <- <primitive 153 self newinstance>. "153 <= classNew"
  22.  
  23.     " The space after the '#new' string is needed by the parser in order"
  24.     " to find the terminating '>' of the primitive!"
  25.  
  26.     <primitive 155 self #new > "respondsTo: #new??"
  27.       ifTrue: [newinstance <- newinstance new].
  28.  
  29.     ^ newinstance
  30. |
  31.   new
  32.     ^ (self basicNew) 
  33. |
  34.   basicNew: aValue  ! superclass newinstance !
  35.  
  36.     superclass <- <primitive 151 self>. "151 <= findSuperClass"
  37.  
  38.     <primitive 3 superclass>  "respondsToNew: superclass"
  39.       ifTrue: [newinstance <- superclass new]. 
  40.  
  41.     newinstance <- <primitive 153 self newinstance>. "153 <= classNew"
  42.  
  43.     " The space after the '#new:' string is needed by the parser in order"
  44.     " to find the terminating '>' of the primitive!"
  45.  
  46.     <primitive 155 self #new: > "respondsTo: #new??"
  47.       ifTrue: [newinstance <- newinstance new: aValue].
  48.  
  49.     ^ newinstance
  50. |
  51.   new: aValue
  52.     ^ (self basicNew: aValue)
  53. |
  54.   printString
  55.     ^ <primitive 152 self >
  56. |
  57.   respondsTo
  58.     <primitive 154 self>
  59. |
  60.   respondsTo: aSymbol ! aClass !
  61.     aClass <- self.
  62.  
  63.     [aClass notNil] 
  64.        whileTrue:
  65.            [ <primitive 155 aClass aSymbol> 
  66.                ifTrue: [ ^ true ].
  67.              
  68.              aClass <- aClass superClass 
  69.            ].
  70.  
  71.     ^ false
  72. |
  73.   superClass
  74.     ^ <primitive 151 self>
  75. |
  76.   variables
  77.     ^ <primitive 158 self>
  78. |
  79.   view
  80.     <primitive 156 self>
  81. |
  82.   getByteArray: methodString
  83.     ^ <primitive 159 self methodString> "159 was an unused primitive."
  84. ]
  85.